package allwe.lock;

public class ThreadLocalTest {

    private static ThreadLocal<String> t1 = new ThreadLocal<>();
    private static ThreadLocal<String> t2 = new ThreadLocal<>();

    public static void main(String[] args) {
        t1.set("123");
        t2.set("456");
        t2.set("789");

        Thread thread1 = new Thread(() -> {
            t1.set("aaa");
            t2.set("bbb");
            System.out.println("thread1-" + t1.get());
            System.out.println("thread1-" + t2.get());
        });

        thread1.start();

        Thread thread = Thread.currentThread();

        System.out.println("main-" + t1.get());
        System.out.println("main-" + t2.get());
    }
}
